﻿using System.Windows;
using System.Windows.Controls;
using University.Workshop.Presenters.Kardex.Register;

namespace University.Workshop.Presentation.Kardex.Register
{
    /// <summary>
    /// Interaction logic for PageRegisterView.xaml
    /// </summary>
    public partial class PageRegisterView : Page, IRegisterNewKardexProductView
    {
        PresenterRegisterNewKardexView pRegisterNewKardexView;
        public PageRegisterView()
        {
            InitializeComponent();
            pRegisterNewKardexView = new PresenterRegisterNewKardexView(this);
        }

        private void btnRegisterMedicine_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewKardexView.RegisterKardex();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewKardexView.GoBackPage();

        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewKardexView.GoNextPage();

        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {

            pRegisterNewKardexView.GoStepOne();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewKardexView.GoStepTwo();
        }

        private void btnCancelRegister_Click(object sender, RoutedEventArgs e)
        {
            RestartRegisterMedicineProduct();
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            pRegisterNewKardexView.FirstTime();
        }

        public void CallSecondPage()
        {

            PageFirstStepRegisterKardexView pp = new PageFirstStepRegisterKardexView(pRegisterNewKardexView);
            RegisterBasicValue = pp;
            frmContent.NavigationService.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        IRegisterBasicView RegisterBasicValue;

        public void CallFirstPage()
        {
            PageSecondStepRegisterKardex pp = new PageSecondStepRegisterKardex(pRegisterNewKardexView);
            RegisterBasicValue = pp;
            frmContent.NavigationService.Navigate(pp);
        }

        public void RestartRegisterMedicineProduct()
        {
            this.NavigationService.Navigate(new PageRegisterView());
        }

        public IRegisterBasicView RegisterBasic
        {
            get
            {
                return RegisterBasicValue;
            }
            set
            {
                RegisterBasicValue = value;
            }
        }

        public void SystemMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ErrorMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Error!!!",MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK,MessageBoxOptions.RightAlign);
        }

    }
}
